class Solution3 {
    public boolean isSymmetric(TreeNode root) {
        return issymmetric(root.left,root.right);
    }
    public boolean issymmetric(TreeNode l,TreeNode r) {
        if(l != null&&r == null || l == null && r != null) {
            return false;
        }
        if(l == null && r == null ) {
            return true;
        }
        if(l.val != r.val ) {
            return false;
        }
        return issymmetric(l.left,r.right) && issymmetric(l.right,r.left);
    }
}